<!-- 站址信息 -->
<template>
  <TCollapse title="项目站址信息">
    <iframe :src="siteDetailsUrl" scrolling="no" width="100%" :height="siteHeight" frameborder="0" />
  </TCollapse>
</template>
<script>

import TCollapse from '@/components/basic/TCollapse.vue'

export default {
  name: 'JnSiteDetail',
  components: { TCollapse },
  props: {
    prjId: {
      type: String,
      default: '',
      required: true
    }
  },
  data() {
    return {
      siteHeight: ''
    }
  },
  computed: {
    siteDetailsUrl() {
      return `${process.env.VUE_APP_JUNNAN_IFRAME_URL}design/siteInfo?prjId=${this.prjId}`
    }
  },
  async created() {
    window.addEventListener('message', (event) => {
      const base_url = ''
      if (event.origin === base_url) {
        return
      }
      if (event.data.type === 'siteHeight') {
        this.siteHeight = event.data.data
      }
    })
  }
}
</script>

<style scoped lang='scss'>
</style>
